Skip to content

Conversation

@hua7450
Copy link
Collaborator

@hua7450 hua7450 commented Jan 7, 2026

Summary

Adds a GitHub Actions workflow for automated weekly updates of policyengine-us package.

Fixes #1178

Features

  • Scheduled runs: Every Wednesday at 5 PM EST (same as policyengine-us)
  • Manual trigger: Can be triggered via workflow_dispatch
  • Auto-detection: Checks PyPI for latest policyengine-us version
  • Changelog summary: Generates a summary of all changes between versions (Added/Changed/Fixed/Removed)
  • Smart PR handling: Updates existing PR if one exists, otherwise creates new one
  • Skip if no updates: Logs notice and exits if already at latest version

How It Works

  1. Fetches current version from setup.py
  2. Checks latest version on PyPI
  3. If update available:
    • Updates setup.py with new version
    • Fetches changelog.yaml from policyengine-us repo
    • Extracts changes between old and new versions
    • Creates changelog_entry.yaml
    • Creates/updates PR with full changelog summary

Files Changed

  • .github/workflows/weekly-update.yaml - Workflow file (invokes scripts)
  • .github/scripts/check_updates.py - Python script for checking updates and generating summary
  • .github/scripts/create_pr.sh - Bash script for creating/updating PRs
  • .github/scripts/test_check_updates.py - Unit tests for the Python script (20 tests)

Code Review Changes

Based on reviewer feedback, refactored the workflow:

  • Extracted large inline Python block into .github/scripts/check_updates.py
  • Extracted PR creation bash logic into .github/scripts/create_pr.sh
  • Added unit tests in .github/scripts/test_check_updates.py covering:
    • Version parsing and comparison
    • Setup.py content extraction and updates
    • Changelog filtering between versions
    • Markdown formatting
    • Changelog entry generation

Test Plan

  • Triggered workflow manually from branch
  • Verified PR was created with correct format
  • Verified changelog summary generation works
  • All 20 unit tests passing
  • Remove temporary test triggers before merge (push trigger and ref override)

@hua7450 hua7450 changed the title Weekly Update Household API Add Weekly Update Household API feature Jan 7, 2026
@hua7450 hua7450 marked this pull request as ready for review January 14, 2026 15:09
@hua7450 hua7450 requested a review from anth-volk January 14, 2026 15:09
Copy link
Collaborator

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @hua7450. One recommendation: I'd write that large bash block as one or more scripts, then invoke in the GH Action. I'd also recommend a few unit tests for said scripts.

@hua7450 hua7450 marked this pull request as draft January 16, 2026 17:50
@hua7450 hua7450 marked this pull request as ready for review January 16, 2026 18:02
@hua7450 hua7450 requested a review from anth-volk January 16, 2026 18:02
Copy link
Collaborator

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hua7450!

@hua7450 hua7450 merged commit 6882c7b into main Jan 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weekly Update Household API

3 participants